<?php

declare (strict_types=1);
namespace Swb\Shop\Model;

use Hyperf\DbConnection\Model\Model as BaseModel;
/**
 * @property string $id
 * @property string $create_time 
 * @property string $create_by 
 * @property string $update_time 
 * @property string $update_by 
 * @property string $project_id 
 * @property string $building_id 
 * @property string $building_name 
 * @property string $building_address 
 * @property string $agent_id 
 * @property string $department 
 * @property int $house_sale_rent 
 * @property string $name 
 * @property string $number 
 * @property float $rental_price 
 * @property float $assignment_fee 
 * @property int $rent_to_pay_cycle 
 * @property int $cash_pledge 
 * @property int $rent_free_period 
 * @property int $contract_term 
 * @property int $first_payment_time 
 * @property float $sale_price 
 * @property int $sale_payment_method_id 
 * @property string $building_no 
 * @property string $building_no_name 
 * @property string $building_unit 
 * @property string $building_unit_name 
 * @property string $floor_number 
 * @property string $floor_number_name 
 * @property string $room_no 
 * @property string $room_no_name 
 * @property float $floor_area 
 * @property float $useable_area 
 * @property int $renovation_type 
 * @property float $shop_height 
 * @property float $shop_wide 
 * @property float $shop_depth 
 * @property int $certificate_type 
 * @property int $operating_state 
 * @property int $key_type 
 * @property string $house_describe 
 * @property int $door_position 
 * @property int $detail_position 
 * @property int $check_type 
 * @property string $check_time 
 * @property int $house_status 
 * @property string $deal_time 
 * @property int $up_and_down_status 
 * @property string $up_and_down_time 
 * @property int $house_source 
 * @property int $del_flag 
 * @property int $shop_dish 
 * @property string $dish_update_time 
 * @property int $degree_new_old 
 * @property int $shop_require 
 * @property string $now_status 
 * @property int $level 
 * @property string $history_agent_id 
 * @property int $high_light 
 * @property int $page_view 
 */
class TShop extends BaseModel
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 't_shop';
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [];
    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = ['id' => 'string', 'house_sale_rent' => 'integer', 'rental_price' => 'float', 'assignment_fee' => 'float', 'rent_to_pay_cycle' => 'integer', 'cash_pledge' => 'integer', 'rent_free_period' => 'integer', 'contract_term' => 'integer', 'first_payment_time' => 'integer', 'sale_price' => 'float', 'sale_payment_method_id' => 'integer', 'floor_area' => 'float', 'useable_area' => 'float', 'renovation_type' => 'integer', 'shop_height' => 'float', 'shop_wide' => 'float', 'shop_depth' => 'float', 'certificate_type' => 'integer', 'operating_state' => 'integer', 'key_type' => 'integer', 'door_position' => 'integer', 'detail_position' => 'integer', 'check_type' => 'integer', 'house_status' => 'integer', 'up_and_down_status' => 'integer', 'house_source' => 'integer', 'del_flag' => 'integer', 'shop_dish' => 'integer', 'degree_new_old' => 'integer', 'shop_require' => 'integer', 'level' => 'integer', 'high_light' => 'integer', 'page_view' => 'integer'];

    protected $keyType='string';
    public function building()
    {
        return $this->belongsTo(TBuilding::class,'building_id')
            ->leftJoin('sys_business_areas as sb','sb.id','=','t_building.business_district_id')
            ->select('t_building.id','business_district_id','building_name','sb.name','sb.province_name','sb.city_name','sb.area_name');

    }

    /**
     * User : 码农先生
     * Email: 807098383@qq.com
     * Website: http://blog.zsboss888.com
     * (1商铺配套 2适合业态 3标签)
     */
    public function house_dict()
    {
        return $this->hasMany(THouseDictionary::class,'house_id');
    }
}